import { post } from '@/api/http';
import { defineStore } from 'pinia'

export const useProductInfoStore = defineStore('productInfo', {
    state: () => {
        return {
            total: 0,
            page: 1,
            size: 10,
            table:{
                dataList:[]
            }as any,
            selectedRowKeys:[] as any,
            rowKey:'id',
            tableColumns:[
                {
                    title: "序号",
                    key: "productTypeCode",
                    dataIndex: "productTypeCode",
                    width: 150
                },
                {
                    title: "类型名称",
                    key: "productTypeName",
                    dataIndex: "productTypeName",
                    width: 150
                },
                {
                    title: "备注",
                    key: "remark",
                    dataIndex: "remark",
                    width: 150
                },
                {
                    title: "创建人",
                    key: "createName",
                    dataIndex: "createName",
                    width: 150
                },
                {
                    title: "创建时间",
                    key: "createTime",
                    dataIndex: "createTime",
                    width: 200
                },
                {
                    title: "最后修改人",
                    key: "updateName",
                    dataIndex: "updateName",
                    width: 150
                },
                {
                    title: "最后修改时间",
                    key: "updateTime",
                    dataIndex: "updateTime",
                    width: 200
                },
                {
                    title: '操作',
                    key: 'id',
                    slotName: 'action',
                    width: 150, fixed: 'right'
                }
            ] as any,
            pageData:{
                nameList: [],
                showAdd: false,
                sideTitle: '新增产品基础资料',
                dropDownData: "",
                pageLoading: false,
                tablediv: null,
                rHeight: "",
                btnList: [],
                isEdit: false
            } as any,
        };
    },
    actions: {
        selectBd(){
            return post({
                url: "product/productType/getPage",
                data: {
                    page: this.page,
                    size: this.size,
                    deleteState: 0,
                    productTypeName: this.pageData.dropDownData
                }
            })
        },
      },
})